<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
            <li>
			提现订单号：<input type="text" name="withdrawId"/>
        </li>
	            <li>
			用户id：<input type="text" name="userId"/>
        </li>
	            <li>
			提现金额：<input type="text" name="amount"/>
        </li>
	            <li>
			提现手续费：<input type="text" name="commission"/>
        </li>
	            <li>
			实际金额：<input type="text" name="actualAmount"/>
        </li>
		<li>
			金额类型：<select name="amountType" th:with="type=${@dict.getType('wdy_amount_type')}">
			<option value="">所有</option>
			<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
					th:value="${dict.dictValue}"></option>
			</select>
		</li>
	            <li>
			提现交易状态(0处理中,1提现成功,2提现失败)：<input type="text" name="withdrawStatus"/>
        </li>
	            <li>
			姓名：<input type="text" name="realName"/>
        </li>
	            <li>
			提现银行卡号：<input type="text" name="bankCardNo"/>
        </li>
	            <li>
			银行名称：<input type="text" name="bankName"/>
        </li>
	            <li>
			银行编码：<input type="text" name="bankCode"/>
        </li>
	            <li>
			开户行：<input type="text" name="bankSubbranch"/>
        </li>
	    		<li class="select-time">
			<label>提现发起时间： </label>
			<input type="text" class="date-input" id="startWithdrawTime" placeholder="开始" name="params[beginWithdrawTime]"/>
			<span>-</span>
			<input type="text" class="date-input" id="endWithdrawTime" placeholder="结束" name="params[endWithdrawTime]"/>
		</li>
	    		<li class="select-time">
			<label>出款时间： </label>
			<input type="text" class="date-input" id="startRemitTime" placeholder="开始" name="params[beginRemitTime]"/>
			<span>-</span>
			<input type="text" class="date-input" id="endRemitTime" placeholder="结束" name="params[endRemitTime]"/>
		</li>
	    		<li class="select-time">
			<label>到账时间： </label>
			<input type="text" class="date-input" id="startCompletedTime" placeholder="开始" name="params[beginCompletedTime]"/>
			<span>-</span>
			<input type="text" class="date-input" id="endCompletedTime" placeholder="结束" name="params[endCompletedTime]"/>
		</li>
	            <li>
			删除标志（0代表存在 1代表删除）：<input type="text" name="delFlag"/>
        </li>
	            <li>
			创建者：<input type="text" name="createBy"/>
        </li>
	    		<li class="select-time">
			<label>创建时间： </label>
			<input type="text" class="date-input" id="startCreateTime" placeholder="开始" name="params[beginCreateTime]"/>
			<span>-</span>
			<input type="text" class="date-input" id="endCreateTime" placeholder="结束" name="params[endCreateTime]"/>
		</li>
	            <li>
			更新者：<input type="text" name="updateBy"/>
        </li>
	    		<li class="select-time">
			<label>更新时间： </label>
			<input type="text" class="date-input" id="startUpdateTime" placeholder="开始" name="params[beginUpdateTime]"/>
			<span>-</span>
			<input type="text" class="date-input" id="endUpdateTime" placeholder="结束" name="params[endUpdateTime]"/>
		</li>
	            <li>
			备注信息：<input type="text" name="remark"/>
        </li>
	            <li>
			钱包地址：<input type="text" name="walletAddress"/>
        </li>
	            <li>
			交易hash：<input type="text" name="txnHash"/>
        </li>
								<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="research()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="col-sm-12 search-collapse">
				<div class="select-list">
					<ul>
						<li>
							CNN提现处理中：<span id="cnnProcess">0</span>
						</li>
						<li>
							CNN提现成功：<span id="cnnSuccess">0</span>
						</li>
						<li>
							VC提币处理中：<span id="vcProcess">0</span>
						</li>
						<li>
							VC提币成功：<span id="vcSuccess">0</span>
						</li>
						<li>
							VC理财提币处理中：<span id="vcwProcess">0</span>
						</li>
						<li>
							VC理财提币成功：<span id="vcwSuccess">0</span>
						</li>
					</ul>
				</div>
			</div>
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="system:wdyWithdraw:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.editFull()" shiro:hasPermission="system:wdyWithdraw:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:wdyWithdraw:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:wdyWithdraw:export">
					<i class="fa fa-download"></i> 导出
				</a>
				<a class="btn btn-success" onclick="confirmAll()" shiro:hasPermission="system:wdyWithdraw:add">
					<i class="fa fa-plus"></i> 审核通过
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var confirmFlag = [[${@permission.hasPermi('system:wdyWithdraw:confirm')}]];
        var editFlag = [[${@permission.hasPermi('system:wdyWithdraw:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:wdyWithdraw:remove')}]];
        var prefix = ctx + "system/wdyWithdraw";
        var amountType = [[${@dict.getType('wdy_amount_type')}]];
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "提现记录",
		        showExport: true,
                sortName: "createTime",
                sortOrder: "desc",
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : 'id',
					visible: false
				},
				{
					field : 'withdrawId', 
					title : '提现订单号',
					sortable: true
				},
				{
					field : 'extraData[mobile]',
					title : '用户手机号码',
					sortable: true,
					formatter: function (value, row, index) {
						return row.extraData['mobile'];
					}
				},
				{
					field : 'userId',
					title : '用户id',
					sortable: true
				},
				{
					field : 'amount', 
					title : '提现金额',
					sortable: true
				},
				{
					field : 'amountType',
					title : '金额类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(amountType, value);
                    }
				},
				{
					field : 'commission',
					title : '提现手续费',
					sortable: true
				},
				{
					field : 'actualAmount', 
					title : '实际金额',
					sortable: true
				},
				{
					field : 'amountType', 
					title : '金额类型',
					sortable: true
				},
                {
                    field : 'withdrawStatus',
                    title : '提币交易状态(0处理中,1提币成功,2提币失败)',
                    formatter: function(value, row, index) {
                        if(value == 0) {
                            return '处理中';
                        } else if(value == 1) {
                            return '成功';
                        } else if(value == 2) {
                            return '失败'
                        }
                        return '-';
                    }
                },
				{
					field : 'realName', 
					title : '姓名',
					sortable: true
				},
				{
					field : 'bankCardNo', 
					title : '提现银行卡号',
					sortable: true
				},
				{
					field : 'bankName', 
					title : '银行名称',
					sortable: true
				},
				{
					field : 'bankCode', 
					title : '银行编码',
					sortable: true
				},
				{
					field : 'bankSubbranch', 
					title : '开户行',
					sortable: true
				},
                {
                    field : 'walletAddress',
                    title : '钱包地址',
                    sortable: true
                },
                {
                    field : 'txnHash',
                    title : '交易hash',
                    sortable: true
                },
				{
					field : 'withdrawTime', 
					title : '提现发起时间',
					sortable: true
				},
				{
					field : 'remitTime', 
					title : '出款时间',
					sortable: true
				},
				{
					field : 'completedTime', 
					title : '到账时间',
					sortable: true
				},
				{
					field : 'delFlag', 
					title : '删除标志（0代表存在 1代表删除）',
					sortable: true
				},
				{
					field : 'createBy', 
					title : '创建者',
					sortable: true
				},
				{
					field : 'createTime', 
					title : '创建时间',
					sortable: true
				},
				{
					field : 'updateBy', 
					title : '更新者',
					sortable: true
				},
				{
					field : 'updateTime', 
					title : '更新时间',
					sortable: true
				},
				{
					field : 'remark', 
					title : '备注信息',
					sortable: true
				},

		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.editFull(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        if(row.withdrawStatus == 0) {
                            actions.push('<a class="btn btn-info btn-xs ' + confirmFlag + '" href="#" onclick="withdrawConfirm(\'' + row.id + '\')"><i class="fa fa-check-square-o"></i>审核</a> ');
                        }
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
            getSum();
        });


		function withdrawConfirm (id) {
            var url = prefix + '/confirm/' + id;
            $.modal.openTab("审核提币", url);
		}

        // 批量删除信息
        function confirmAll() {
            var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            $.modal.confirm("确认审核通过选中的" + rows.length + "条数据吗?", function() {
                var url = prefix + "/confirmAll";
                var data = { "ids": rows.join() };
                $.operate.submit(url, "post", "json", data);
            });
        }

        function showTxn(id) {
            var url = [[${@config.getKey('etherscan_url')}]] + '/tx/' + id;
            window.open(url);
        }

		function research() {
            getSum();
            $.table.search()
        }

        function getSum() {
            $.ajax({
                type: 'post',
                url: prefix + "/getSum",
                data: $('#formId').serializeArray(),
                dataType: 'json',
                success: function (data) {
                    if (data != null) {
                        $("#cnnProcess").text(data.cnnProcess);
                        $("#cnnSuccess").text(data.cnnSuccess);
                        $("#vcProcess").text(data.vcProcess);
                        $("#vcSuccess").text(data.vcSuccess);
                        $("#vcwProcess").text(data.vcwProcess);
                        $("#vcwSuccess").text(data.vcwSuccess);
                    }
                }
            })
        }
    </script>
</body>
</html>